﻿using UnityEngine;
using System.Collections;
using FairyGUI;

/// <summary>
/// 衡阳六胡抢
/// </summary>
public class UICreateRoom_GameHengYangLiuHuQiang : UICreateRoom_GameBase {

    GComponent _comp;
    UICreateRoom_RoundSel _roundSelCtrl;

	public UICreateRoom_GameHengYangLiuHuQiang(GComponent comp)
    {
        _comp = comp;

        GButton okBtn = comp.GetChild("确认按钮").asButton;
        okBtn.onClick.Add(()=> {
            DebugInfo.Log("衡阳六胡抢 确认按钮被点击");

            AudioController.inst.PlayUIClickEffect();

            Hashtable createArgs = new Hashtable();
            if (comp.GetChild("底分2分").asButton.selected)
            {
                createArgs["base2"] = true;
            }
            if (comp.GetChild("随省").asButton.selected)
            {
                createArgs["suiXing"] = true;
            }
            if (comp.GetChild("翻省").asButton.selected)
            {
                createArgs["fanXing"] = true;
            }
            if (comp.GetChild("红点黑").asButton.selected)
            {
                createArgs["hongDianHei"] = true;
            }
            createArgs["round"] = _roundSelCtrl.round;
            createArgs["gameType"] = Constants.GAME_HENGYANGLIUHUQIANG;
            createArgs["uid"] = DataKernel.inst.userInfo.uid;

            UIRootController.inst.ShowMask(true);
            NetIOController.inst.SendMessage(new IOMessage(
                IOCmds.CMSG_CREATE_ROOM, 
                IOStates.STATE_OK, 
                new HashtableEx(createArgs)
                ));
        });

        _roundSelCtrl = new UICreateRoom_RoundSel(comp.GetChild("选择局数").asCom);

    }

    public override void Show(bool show)
    {
        _comp.enabled = show;
        _comp.visible = show;
    }

    public override int game
    {
        get
        {
            return Constants.GAME_HENGYANGLIUHUQIANG;
        }
    }
}
